package com.link2room.rodimus.factory;

import com.link2room.common.exception.SysException;
import com.link2room.common.util.L2RAssert;
import com.link2room.common.util.SpringUtil;
import com.link2room.rodimus.constant.SignInConstant;
import com.link2room.rodimus.handler.ISignInDrawReissueHandler;

import static com.link2room.enums.exception.RodimusSysExceptionEnum.SIGN_IN_REISSUE_RULE;

/**
 * Created by LN on 2018/1/10
 */
public final class SignInDrawReissueHandlerFactory {
    public final static ISignInDrawReissueHandler getHandler(String type){
        ISignInDrawReissueHandler handler = null;

        switch (type){
            case SignInConstant.ReissueType.RESV:
                handler = (ISignInDrawReissueHandler) SpringUtil.getBean("signInDrawReissueResvHandler");
                break;
            case SignInConstant.ReissueType.SHAER:
                handler = (ISignInDrawReissueHandler) SpringUtil.getBean("signInDrawReissueShareHandler");
                break;
            default:
                handler = null;
        }
        L2RAssert.isTrue(null == handler,new SysException(SIGN_IN_REISSUE_RULE,"没有对应补签奖励类型[type] " + type));
        return handler;
    }
}
